library(foreign)
library(ggplot2)
library(msm)
library(sandwich)

## Use Figure1.csv

    ggplot(figure1, aes(x=deciles)) + 
  geom_pointrange(aes(y = incomep, ymin=lli, ymax=uli, colour = "Income")) +  geom_pointrange(aes(y = consumption, ymin=cll, ymax=cul, colour = "Wealth")) + 
  geom_pointrange(aes(y = civic, , ymin=civicll, ymax=civicul, colour = "Civic"))+ 
  geom_line(aes(y = incomep, colour = "Income"))+ geom_line(aes(y = civic, colour = "Civic"))+ geom_line(aes(y = consumption, colour = "Wealth"))+ylab("Probability of Vote Buying Offer")+xlab("Civic Decile")+ scale_colour_grey() + theme_bw() +opts(axis.line = theme_segment(colour = "black"),
    panel.grid.major = theme_blank(),
    panel.grid.minor = theme_blank(),
    panel.border = theme_blank(),
    panel.background = theme_blank()) + theme(legend.title=element_blank())+ theme(legend.position=c(.7, .85))+ scale_x_discrete(breaks=c(2,4,6,8,10))+ scale_y_continuous(limits=c(0.05, .35))
    
 ##  Use Figure2.csv
 ## Income     

ggplot(figure2, aes(x=Decile)) + 
  geom_point(aes(y = ArgentinaI, colour = "Argentina"))   +geom_line(aes(y = ArgentinaI, colour = "Argentina"))+
    geom_point(aes(y = ColombiaI, colour = "Colombia")) +  geom_line(aes(y = ColombiaI, colour = "Colombia"))+
        geom_point(aes(y = PeruI, colour = "Peru"))  +geom_line(aes(y = PeruI, colour = "Peru"))+                geom_point(aes(y = MexicoI, colour = "Mexico")) +  geom_line(aes(y = MexicoI, colour = "Mexico"))+  geom_point(aes(y = BrazilI, colour = "Brazil")) +  geom_line(aes(y = BrazilI, colour = "Brazil"))  + scale_colour_grey() + theme_bw() +opts(axis.line = theme_segment(colour = "black"),
    panel.grid.major = theme_blank(),
    panel.grid.minor = theme_blank(),
    panel.border = theme_blank(),
    panel.background = theme_blank()) + theme(legend.title=element_blank())+ theme(legend.position=c(.8, .8))+ scale_x_discrete(breaks=c(2,4,6,8,10))+ scale_y_continuous(limits=c(0.05, .35))  +ylab("Probability of Vote Buying Offer")+ scale_colour_grey() +xlab("Income Decile")

       

##  Civic

ggplot(figure2, aes(x=Decile)) + 
  geom_point(aes(y = Argentinac, colour = "Argentina"))   +geom_line(aes(y = Argentinac, colour = "Argentina"))+
    geom_point(aes(y = Colombiac, colour = "Colombia")) +  geom_line(aes(y = Colombiac, colour = "Colombia"))+
        geom_point(aes(y = Peruc, colour = "Peru"))  +geom_line(aes(y = Peruc, colour = "Peru"))+                geom_point(aes(y = Mexicoc, colour = "Mexico")) +  geom_line(aes(y = Mexicoc, colour = "Mexico"))+  geom_point(aes(y = Brazilc, colour = "Brazil")) +  geom_line(aes(y = Brazilc, colour = "Brazil"))  + scale_colour_grey() + theme_bw() +opts(axis.line = theme_segment(colour = "black"),
    panel.grid.major = theme_blank(),
    panel.grid.minor = theme_blank(),
    panel.border = theme_blank(),
    panel.background = theme_blank()) + theme(legend.title=element_blank())+ theme(legend.position=c(.2, .8))+ scale_x_discrete(breaks=c(2,4,6,8,10))+ scale_y_continuous(limits=c(0.05, .35))  +ylab("Probability of Vote Buying Offer")+ scale_colour_grey() +xlab("Civic Decile")
  
    